package com.example.anodemo.mapper;

import com.example.anodemo.model.Order;
import org.apache.ibatis.annotations.*;
import org.apache.ibatis.mapping.FetchType;

@Mapper
public interface OrderMapper {


    @Select("select * from `order` where order_id = #{orderId}")
    @Results(value = {
            @Result(column = "order_id",property = "orderId"),
            @Result(column = "order_no",property = "orderNO"),
            @Result(column = "order_id",property = "orderDetailList",
                    many=@Many(
                            select = "com.example.anodemo.mapper.OrderDetailMapper.selectByOrderId"
                            ,fetchType = FetchType.LAZY))
    })
    Order selectById(Integer orderId);


}
